package tk.hongbo.socket;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
public class JobTask {

    @Scheduled(fixedRate = 2000)
    public void dear() {
        SocketManager.getAll().forEach((s, session) -> {
            try {
                session.getBasicRemote().sendText(s + ":来自服务端消息");
            } catch (IOException e) {
                e.printStackTrace();
            }
        });
    }
}
